﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace CommunitySystem
{
    public partial class DiaoDongTypeWindow : ChildWindow
    {
        public string Type { get; set; }
        public int ID;
        public int OrgID;
        public bool IsNew = false;
        public string SFCK = "";
        public string OrgName = "";
        public DiaoDongTypeWindow(int orgID, int iD, bool isnew, string shifouchakan,string orgname)
        {
            InitializeComponent();
            this.Title = "新增调动";
            ID = iD;
            OrgID = orgID;
            IsNew = isnew;
            SFCK = shifouchakan;
            OrgName = orgname;
            type.DataContext = this;
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if(string.IsNullOrEmpty(Type))
            {
                SilverlightMessageBoxLibrary.Message.ErrorMessage("请选择调动类型！");
                return;
            }
            if (Type == "区内调动")
            {
                DiaoDongWindow_DiaoRen RMWindow = new DiaoDongWindow_DiaoRen(OrgID, 0, true, "非查看", Type);
                RMWindow.Closed += new EventHandler(RMWindow_Closed);
                RMWindow.Show();
            }
            else if (Type == "调任" || Type == "外区调入" || Type == "外省市调入")
            {
                DiaoDongWindow RMWindow = new DiaoDongWindow(OrgID, 0, true, "非查看", Type);
                RMWindow.Closed += new EventHandler(RMWindow_Closed);
                RMWindow.Show();
            }
            else if(Type == "单位内转任")
            {
                DiaoDongWindow_DanWeiNeiZhuanRen RMWindow = new DiaoDongWindow_DanWeiNeiZhuanRen(OrgID, 0, true, "非查看",OrgName);
                RMWindow.Closed += new EventHandler(RMWindow_Closed);
                RMWindow.Show();
            }
            else
            {
                DiaoDongWindow_DiaoChuBenQu RMWindow = new DiaoDongWindow_DiaoChuBenQu(OrgID, 0, true, "非查看", Type);
                RMWindow.Closed += new EventHandler(RMWindow_Closed);
                RMWindow.Show();
            }
        }

        void RMWindow_Closed(object sender, EventArgs e)
        {
            this.DialogResult = true;
        }
    }
}
